<!-- The view to create/edit a medicine coefficient -->
<script src="{$base_dir}modules/dept_medicine/js/AJAX_Medicine.js" type="text/javascript" ></script>
<script type="text/javascript">
{literal}
$(document).ready(function() {
	oldIssueNumGlb = +$('#oldIssueNumber').val();
	oldUsedNumGlb = +$('#oldUsedNumber').val();
});
{/literal}
</script>
<form id="updateMedicineUsgStatusForm" name="updateMedicineUsgStatusForm">
    <input type="hidden" id="medCoefId" name="medCoefId" value="{$medCoefId}">
    <input type="hidden" id="medUsgStatusId" name="medUsgStatusId" value="{$medUsgStatus.med_usg_status_id}">
    <input type="hidden" id="oldIssueNumber" name="oldIssueNumber" value="{$medUsgStatus.issue_num}">
    <input type="hidden" id="oldUsedNumber" name="oldUsedNumber" value="{$medUsgStatus.used_num}">
    <div class="form_container" style="width: 560px;">
        <div>
            <span id="statusMessage" style="font-style: italic; color: red;"></span>
        </div>
        <table cellspacing="0" cellpadding="0">
            <tr>
                <td>{translate}Today{/translate}</td>
                <td colspan="3">{$today}</td>
            </tr>
            <tr>
                <td>{translate}Medicine type{/translate}</td>
                <td>{$medTypeName}</td>
                <td>{translate}Medicine name{/translate}</td>
                <td>{$medName}</td>
            </tr>
            <tr>
                <td>{translate}Issue number{/translate}</td>
                <td>
                    <input type="text" id="issueNumberTxt" name="issueNumberTxt" value="{$medUsgStatus.issue_num}" 
                        onChange="javascript:updateRemainNumber('issue');" onkeyup="javascript:this.value=this.value.replace(/[^0-9]/g, '');"/>
                </td>
                <td>{translate}Used number{/translate}</td>
                <td>
                    <input type="text" id="usedNumberTxt" name="usedNumberTxt" value="{$medUsgStatus.used_num}"
                        onChange="javascript:updateRemainNumber('used');" onkeyup="javascript:this.value=this.value.replace(/[^0-9]/g, '');"/>
                </td>
            </tr>
            <tr>
                <td>{translate}Remain number{/translate}</td>
                <td colspan="3">
                    <input type="text" id="remainNumberTxt" name="remainNumberTxt" value="{$medUsgStatus.remain_num}"/>
                </td>
            </tr>
        </table>
    </div>
    <!-- button -->
    <div align="right" style="padding-top: 10px; width: 580px;">
        <div id="btn_save">
            <a id="button_save" class="button_link" href="javascript:saveMedicineUsgStatus();">
                {if $medUsgStatus.med_usg_status_id > 0}
                    {translate}Save{/translate}
                {else}
                    {translate}Create new{/translate}
                {/if}
            </a>
        </div>
        <div id="barLoading" style="display:none;">
            <img src="{$base_uri}images/ajax-loader.gif"/>
        </div>
    </div>
</form>